home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / bin / pitivi < prev    next >
Encoding:
Text File  |  2010-07-09  |  2.9 KB  |  109 lines

  1. #!/usr/bin/env python
  2. # PiTiVi , Non-linear video editor
  3. #
  4. #       pitivi
  5. #
  6. # Copyright (c) 2005, Edward Hervey <bilboed@bilboed.com>
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU Lesser General Public
  10. # License as published by the Free Software Foundation; either
  11. # version 2.1 of the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16. # Lesser General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Lesser General Public
  19. # License along with this program; if not, write to the
  20. # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. # Boston, MA 02111-1307, USA.
  22.  
  23. import os
  24. import sys
  25. import string
  26. import locale
  27. import gettext
  28.  
  29. # variables
  30. CONFIGURED_PYTHONPATH = ''
  31. LIBDIR = '/usr/lib'
  32.  
  33. localedir = ""
  34.  
  35. # Add the path of pitivi stuff
  36. # TODO : change it when it's finally in cvs
  37.  
  38. def _get_root_dir():
  39.     return '/'.join(os.path.dirname(os.path.abspath(__file__)).split('/')[:-1])
  40.  
  41. def _add_pitivi_path():
  42.     global localedir
  43.     dir = os.path.dirname(os.path.abspath(__file__))
  44.     root = os.path.join(LIBDIR, 'pitivi', 'python')
  45.     localedir = "/usr/share/locale"
  46.  
  47.     if not root in sys.path:
  48.         sys.path.insert(0, root)
  49.  
  50.     # prepend any directories found at configure time if they're not
  51.     # already in the path. (if they are already in the path, the user
  52.     # chose to have it that way, so we leave their order)
  53.     for path in string.split(CONFIGURED_PYTHONPATH, ':'):
  54.         if path not in sys.path:
  55.             sys.path.insert(0, path)
  56.  
  57.     # Added for i18n
  58.     try:
  59.         locale.setlocale(locale.LC_ALL, '')
  60.         locale.bindtextdomain('pitivi', localedir)
  61.         locale.textdomain('pitivi')
  62.  
  63.         gettext.bindtextdomain('pitivi', localedir)
  64.         gettext.textdomain('pitivi')
  65.     except:
  66.         print "Couldn't set locale !, reverting to C locale"
  67.  
  68. def _init_gobject_gtk_gst():
  69.     global localedir
  70.     try:
  71.         import pygtk
  72.         pygtk.require("2.0")
  73.  
  74.         import gtk
  75.  
  76.         import gobject
  77.         gobject.threads_init()
  78.     except ImportError:
  79.         raise SystemExit("PyGTK couldn't be found !")
  80.  
  81.     gobject.threads_init()
  82.  
  83.     try:
  84.         from gtk import glade
  85.     except ImportError:
  86.         raise SystemExit("Can't find glade module")
  87.  
  88.     glade.bindtextdomain('pitivi', localedir)
  89.  
  90.     try:
  91.         import pygst
  92.         pygst.require('0.10')
  93.  
  94.         import gst
  95.     except ImportError:
  96.         raise SystemExit("Gst-Python couldn't be found!")
  97.  
  98. def _run_pitivi():
  99.     import pitivi.application as ptv
  100.  
  101.     sys.exit(ptv.main(sys.argv))
  102.  
  103. try:
  104.     _add_pitivi_path()
  105.     _init_gobject_gtk_gst()
  106.     _run_pitivi()
  107. except KeyboardInterrupt:
  108.     print "Interrupted by user!"
  109.